import db from '../db'
import data from '../data'
import {isValidValue} from './password'

export default () => {
  const myclass = localStorage.getItem('myclass')
  if(!isValidValue(myclass) || !data[myclass]) {
    return Promise.resolve(false)
  }
  return db.students.where('classname').equals(myclass)
    .filter(({recognized}) => recognized > 3)
    .count()
    .then(num => num === data[myclass].length)
}
